<?php
@session_start();
require_once("../model/user.php");

$obj_user = new User();

$username = $_SESSION['username'];
$oldPass  = $_POST['oldPass'];
$newPass  = $_POST['newPass'];

$msg = array();
if($obj_user->change_password_by_username($oldPass, $username, $newPass) == true)
{
    $msg['ok'] = "Change password success!";
} else {
    $msg['fail'] = "Not ok";
}

$json_string = json_encode($msg);

echo $json_string;